package cn.portx.el;

import java.io.IOException;
import java.util.Map;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import com.bstek.dorado.core.el.ContextVarsInitializer;

public class ExpenseAuthorityVars implements ContextVarsInitializer, ApplicationContextAware {

	private ApplicationContext applicationContext;

	@Override
	public void initializeContext(Map<String, Object> map) throws Exception {
		map.put("expenseAuthority", this);
	}

	public String load() throws IOException {
		LoadExpenseAuthority loadExpenseAuthority = this.applicationContext.getBean(LoadExpenseAuthority.class);
		return loadExpenseAuthority.load();
	}

	@Override
	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
		this.applicationContext = applicationContext;
	}
}
